﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;
namespace DAO
{
    public class HoSoBenhAn_DAO
    {
        public static Boolean ThemHoSoBenhAn(HoSoBenhAn_DTO hsba_dto)
        {
            List<SqlParameter> ParaArr = new List<SqlParameter>();
            string procname = "sp_ThemHoSoBenhAn";
            ParaArr.Add(new SqlParameter("@NgayLap", hsba_dto.NgayLap));
            ParaArr.Add(new SqlParameter("@ChuanDoan", hsba_dto.ChuanDoan));
            ParaArr.Add(new SqlParameter("@ChiDinh", hsba_dto.ChiDinh));
            ParaArr.Add(new SqlParameter("@TrieuChung ", hsba_dto.TrieuChung));
            ParaArr.Add(new SqlParameter("@MaBN", hsba_dto.MaBN));
            ParaArr.Add(new SqlParameter("@MaNV", hsba_dto.MaNV));
            return DataProvider.NonqueryProc(procname, ParaArr);
        }

        public static Boolean XoaHoSoBenhAN(string Ma)
        {
            List<SqlParameter> ParaArr = new List<SqlParameter>();
            string procname = "sp_XoaHoSoBenhAn";
            ParaArr.Add(new SqlParameter("@MaHoSo", Ma));
            return DataProvider.NonqueryProc(procname, ParaArr);
        }

        public static DataTable DanhSachHoSoBA(string ma)
        {
            List<SqlParameter> ParaArr = new List<SqlParameter>();
            string procname = "sp_DanhSachHoSoBenhAn";
            ParaArr.Add(new SqlParameter("@MaBN", ma));
            DataTable dt = DataProvider.SelectStoreProcedure(procname, ParaArr);
            return dt;
        }

        public static Boolean CapNhatHSBA(HoSoBenhAn_DTO HSBADto)
        {
            List<SqlParameter> ParaArr = new List<SqlParameter>();
            string procname = "sp_CapNhatHoSoBA";
            ParaArr.Add(new SqlParameter("@MaHoSo", HSBADto.MaHoSo));
            ParaArr.Add(new SqlParameter("@NgayLap", HSBADto.NgayLap));
            ParaArr.Add(new SqlParameter("@ChuanDoan",HSBADto.ChuanDoan));
            ParaArr.Add(new SqlParameter("@ChiDinh", HSBADto.ChiDinh));
            ParaArr.Add(new SqlParameter("@TrieuChung ",HSBADto.TrieuChung));
            ParaArr.Add(new SqlParameter("@MaNV ", HSBADto.MaNV));
            return DataProvider.NonqueryProc(procname, ParaArr);
        }

        public static DataTable DanhSachHSBATheoMa(string ma)
        {
            List<SqlParameter> ParaArr = new List<SqlParameter>();
            string procname = "sp_DanhSachHoSoBenhAnTheoMa";
            ParaArr.Add(new SqlParameter("@MaHoSo", ma));
            DataTable dt = DataProvider.SelectStoreProcedure(procname, ParaArr);
            return dt;
        }



    }
}
